public class Main {
    public static void main(String[] args) {
         MySingleList mySingleList = new MySingleList();
        mySingleList.createLink();
        mySingleList.display();
         System.out.println("====尾插====");
        mySingleList.addLast(10);
        mySingleList.addLast(20);
        mySingleList.addLast(30);
        mySingleList.display();
         System.out.println("============");
         //链表的反转
        MySingleList.Node ret =   mySingleList.reverseList();
        // 从指定位置开始打印
         mySingleList.display(ret);
    }
    public static void main1(String[] args) {
        // 链表是一个Node类

        MySingleList mySingleList = new MySingleList();
        mySingleList.createLink();
        mySingleList.display();
        System.out.println("==========");
        mySingleList.display();
        boolean flg =  mySingleList.contains(0);
        System.out.println(flg);
        System.out.println(mySingleList.size());
        System.out.println("====尾插====");
        mySingleList.addLast(10);
        mySingleList.addLast(20);
        mySingleList.addLast(30);
        mySingleList.display();
        System.out.println("====头插====");
        mySingleList.addFirst(10);
        mySingleList.addFirst(20);
        mySingleList.addFirst(30);
        mySingleList.display();
        System.out.println("===========");
        mySingleList.addIndex(2,43);
        mySingleList.display();
        System.out.println("============");
        mySingleList.remove(10);
        mySingleList.remove(10);
        mySingleList.remove(30);
        mySingleList.remove(30);
        mySingleList.display();
        System.out.println("============");
        mySingleList.removeAllKey(20);
        mySingleList.display();
    }
}